namespace Warehouse

open System.Windows.Data
open FSharp.Windows
open Warehouse.Controls

type DatabaseMaintenanceEvents = 
    | SelectFile
    | Start 

type DatabaseMaintenanceView() = 
    inherit View<DatabaseMaintenanceEvents, DatabaseMaintenanceModel, DatabaseMaintenanceWindow>()
    
    override this.EventStreams = 
        [
            this.Control.SelectFile, SelectFile
            this.Control.Start, Start
        ] 
        |> List.ofButtonClicks


    override this.SetBindings model =
        Binding.FromExpression 
            <@
                this.Control.Title <- model.Title
                this.Control.FileName.Text <- model.FileName
                this.Control.ProgressBar.Value <- model.Progress
                this.Control.ProressText.Text <- model.ProgressText
            @>        
            
